package com.cuts.videoedit.data

import java.util.concurrent.LinkedBlockingQueue

class YuvQueue {
    private val list: LinkedBlockingQueue<YUVDataBean> = LinkedBlockingQueue<YUVDataBean>()

    public fun enQueue(packetBean:YUVDataBean ): Boolean{
            return list.offer(packetBean)
    }

    fun deQueue(): YUVDataBean? {
        return list.poll()
    }

    public fun getFirst():YUVDataBean?{
        return list.peek()
    }

    fun getQueueSize(): Int {
        return list.size
    }

    @Synchronized
    fun clear() {
        if (list.isEmpty()) {
            return
        }
        list.clear()
    }

}